/******************************************************************************
Project    : Real time rtsp server library base on live555
*******************************************************************************
File Name    :  <AmrRTimeFramedSource.h>:  amr real time framed source head file
Module Name  :  
Description  :  None
History      :
 No.   Ver.     Date        Designed by  Comment
-----+--------+----------+------------+---------------------------------------
 001   0.00.01  06/02/2015  <3G@LIURENHUA>   <amr real time framed source head file>
*******************************************************************************/
#ifndef _AMR_FRAMED_RTIME_SOURCE_H
#define _AMR_FRAMED_RTIME_SOURCE_H

#ifdef LOCAL_SOCK_INPUT
#include <LocalUdpSocket.h>
#endif /* LOCAL_SOCK_INPUT */
#include <AMRAudioSource.hh>

#include "RealTimeRtspServer_common.h"

//#define NOCMP_FRAME		/* not complete frame */
/******************************************************************************
  class declaration
 ******************************************************************************/
class AmrRTimeFramedSource : public AMRAudioSource
{
public:	
	static AmrRTimeFramedSource* createNew(
							UsageEnvironment & env,
#ifdef LOCAL_SOCK_INPUT
							const char  *pcIdentity,
#endif /* LOCAL_SOCK_INPUT */
							const Boolean bWideBand,
							const u_int8_t ucChNum,
#ifdef LOCAL_SOCK_INPUT
							const u_int32_t unSBufSize,
							const u_int32_t unRBufSize
#else
							queue_t *pstQue
#endif /* LOCAL_SOCK_INPUT */
							);
private:
	/* Constructor function */
	AmrRTimeFramedSource(
							UsageEnvironment & env,
#ifdef LOCAL_SOCK_INPUT
							const char  *pcIdentity,
#endif /* LOCAL_SOCK_INPUT */
							const Boolean bWideband,
							const u_int8_t ucChNum,
#ifdef LOCAL_SOCK_INPUT
							const u_int32_t unSBufSize,
							const u_int32_t unRBufSize
#else
							queue_t *pstQue
#endif /* LOCAL_SOCK_INPUT */
							);
	/* Destructor function */
	virtual ~AmrRTimeFramedSource(void);
	virtual void doGetNextFrame();
	
private:
#ifdef LOCAL_SOCK_INPUT
	/* Local socket object pointer */
	LSOCK_OBJECT_st *pstServer;
#else
	queue_t *m_que;
#endif /* LOCAL_SOCK_INPUT */

	/* Local buffer for frame check */
	u_int8_t *m_pucLocalBuffer;
#ifdef NOCMP_FRAME
	/* Local buffer write index */
	u_int16_t m_usWrite;
#endif /* NOCMP_FRAME */
};
#endif /* _AMR_FRAMED_RTIME_SOURCE_H */
